<%--
  Created by IntelliJ IDEA.
  User: 86173
  Date: 2021/11/24
  Time: 21:51
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%
        pageContext.setAttribute("APP_PATH",request.getContextPath());
    %>
<%--    <link rel="stylesheet" href="${APP_PATH}/static/css/font-awesome-4.7.0/css/font-awesome.min.css">--%>
    <link rel="stylesheet" href="${APP_PATH}/static/css/style.css">

    <script src="${APP_PATH}/static/js/jquery-3.3.1.min.js"></script>
    <script src="${APP_PATH}/static/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
    <style>
        /*#input label{*/
        /*    !*border: #b2dba1 solid 1px;*!*/
        /*    clear: left;*/
        /*}*/
        /*#input input{*/
        /*    width: 5%;*/
        /*    clear: both !important;*/
        /*    float: none !important;*/
        /*    height: 20px;*/
        /*    top: 0px;*/

        /*}*/
        /*.input{*/
        /*    !*border: black solid 1px;*!*/
        /*}*/
        /*.overbox .input {*/
        /*    margin-top: 10px !important;*/
        /*    font-size: 22px;*/
        /*}*/
        /*.overbox{*/
        /*    padding: 25px 50px !important;*/
        /*}*/
        /*.input label {*/
        /*    line-height: 40px;*/
        /*}*/
        /*.title {*/
        /*    line-height: 15px !important;*/
        /*    letter-spacing: 3px !important;*/
        /*}*/
        /*.input .button {*/
        /*    height: 50px !important;*/
        /*}*/
        /*#button{*/
        /*    margin-top: 15px;*/
        /*}*/
        /*.login button{*/
        /*    line-height: 40px !important;*/
        /*}*/
    </style>
</head>
<body>
<div class="materialContainer">
    <div class="box">

        <div class="title">用户登录</div>
        <form method="post" action="/user">
            <div class="input">
                <label for="username">用户名</label>
                <input type="text" name="username" id="username">
                <span class="spin"></span>
            </div>
            <div class="input">
                <label for="userpassword">密码</label>
                <input type="password" name="userpassword" id="userpassword">
                <span class="spin"></span>
            </div>
            <div class="button login">
                <button>
                    <span>登录</span>
                    <i class="fa fa-check"></i>
                </button>
            </div>
        </form>
<%--        <a href="${APP_PATH}/admin">进入后台登录</a>--%>
    </div>
    <div class="overbox">
        <div class="material-button alt-2">
            <span class="shape"></span>
        </div>
        <div class="title">管理员登录</div>
        <form method="post" action="/admin">
            <div class="input">
                <label for="adminname">用户名</label>
                <input type="text" name="adminname" id="adminname">
                <span class="spin"></span>
            </div>
            <div class="input">
                <label for="adminpassword">密码</label>
                <input type="password" name="adminpassword" id="adminpassword">
                <span class="spin"></span>
            </div>
            <div class="button login">
                <button>
                    <span>登录</span>
                    <i class="fa fa-check"></i>
                </button>
            </div>
        </form>

    </div>
${error.msg.toString()}
</div>
<script src="${APP_PATH}/static/js/login-min.js"></script>
<script type="text/javascript">
    $(function (){
        let error = ${error.code};
        let message = '${error.extend.message}';
        if (error == 200){
            alert(message);
        }
    <%--    //获取登录按钮--%>
    <%--    $(".login").click(function (){--%>
    <%--        let serialize = $(".box form").serialize();--%>
    <%--        let component = decodeURIComponent(serialize);--%>
    <%--        $.ajax({--%>
    <%--            url:"${APP_PATH}/user",--%>
    <%--            type:'get',--%>
    <%--            data:component,--%>
    <%--            success:function (result){--%>
    <%--                // console.log(result);--%>
    <%--                // alert(result);--%>

    <%--                if (result.code == 200){--%>
    <%--                    alert("用户名或密码错误！！！");--%>
    <%--                }else{--%>
    <%--                    &lt;%&ndash;window.location.replace("${APP_PATH}/test");&ndash;%&gt;--%>

    <%--                }--%>

    <%--            }--%>
    <%--        })--%>
    <%--    })--%>


    })
</script>
</body>
</html>
